<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="password" v-model="pwd" @keyup.enter="handleEnter">
    </div>
    <script>
        /* [a-z]+\d{7,} */

        var vm=new Vue({
            el:"#app",
            data:{
                pwd:""
            },
            methods:{
                handleEnter(){
                    var reg=/^[a-z]+[0-9]{7,}$/i
                    console.log(this.pwd.trim())
                    if(!reg.test(this.pwd.trim())){
                        alert("密码不合法，应该以字母开头，包含数字字符，长度不小于8位")
                    }
                }
            }
        })
    </script>
</body>
</html>